import logging
import pytest
import yagmail

def log_set():
    logging.basicConfig(filename="log.log",filemode="a+",level=logging.DEBUG,format="%(levelname)s -> %(filename)s -> %(asctime)s -> %(message)s")

def send_mail(filepath):
    mail = yagmail.SMTP(user="1508523002@qq.com",password="bgbsnkdrydkgbagf",host="smtp.qq.com")
    send_mail = mail.send(to="1508523002@qq.com",subject="邮件",contents="邮件",attachments=filepath)

if __name__ == '__main__':
    log_set()
    pytest.main(['-s','test_a3mall_jifen.py','--html=baogao.html'])
    send_mail(['log.log','baogao.html'])